home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / PacMan / InfoController.m < prev    next >
Encoding:
Text File  |  1992-08-17  |  3.2 KB  |  130 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "InfoController.h"
  5. #import <appkit/Window.h>
  6. #import <strings.h>
  7. #import <libc.h>
  8. #import <appkit/Application.h>
  9. #import <appkit/Panel.h>
  10. #import <appkit/TextField.h>
  11. #import <appkit/defaults.h>    /* preferences (defaults) */
  12. #import <appkit/Speaker.h>
  13. #import <appkit/Listener.h>
  14.  
  15.  
  16. @implementation InfoController
  17.  
  18. - init                // make sure that *Panel is nil.
  19. {
  20.     self = [super init];
  21.     infoPanel = nil;
  22.     helpPanel = nil;
  23.     licensePanel = nil;
  24.     READMEPanel = nil;
  25.     return self;
  26. }
  27.  
  28. - infoPanel        // return the infoPanel, load it if needed.
  29. {
  30.   if( !infoPanel)
  31.     [NXApp loadNibSection:"InfoPanel.nib" owner:self withNames:NO];
  32.   return infoPanel;
  33. }
  34.  
  35. - helpPanel        // return the helpPanel, load it if needed.
  36. {
  37.   if( !helpPanel)
  38.     [NXApp loadNibSection:"HelpPanel.nib" owner:self withNames:NO];
  39.   return helpPanel;
  40. }
  41.  
  42. - licensePanel        // return the licensePanel, load it if needed.
  43. {
  44.   if( !licensePanel)
  45.     [NXApp loadNibSection:"LicensePanel.nib" owner:self withNames:NO];
  46.   return licensePanel;
  47. }
  48.  
  49. - readmePanel    // return the READMEPanel, load it if needed.
  50. {
  51.   if( !READMEPanel)
  52.     [NXApp loadNibSection:"README.nib" owner:self withNames:NO];
  53.   return READMEPanel;
  54. }
  55.  
  56. - info:sender        // make the info panel be up there.
  57. {
  58.   [[self infoPanel] orderFront:sender];
  59.   return self;
  60. }
  61.  
  62. - help:sender        // make the help panel be up there.
  63. {
  64.     [[self helpPanel] orderFront:sender];
  65.     return self;
  66. }
  67.  
  68. - license:sender    // make the license panel be up there.
  69. {
  70.     [[self licensePanel] orderFront:sender];
  71.     return self;
  72. }
  73.  
  74. - readme:sender    // make the README panel be up there.
  75. {
  76.     [[self readmePanel] orderFront:sender];
  77.     return self;
  78. }
  79.  
  80. - suggestion:sender    // This is pretty much lifted from Opener.
  81. {
  82.     char subj[256];
  83.     char body[4096]="\
  84. Don:\n\n\
  85. I've been playing PacMan a bit and find it to be\n\
  86. simply piles of fun.  In fact, I think it would be\n\
  87. even more fun if it:\n\n\
  88. <insert interesting suggestions here>\n\n\
  89. I also found that I had the following problems:\n\n\
  90. <insert report of annoying bugs here>\n\n\
  91. Well, thanks for the prompt reply I know you'll\n\
  92. be sending to me...\n\n\
  93.              I love to play games on the NeXT,\n\
  94.              ";
  95.  
  96. #define call(a,b) [s performRemoteMethod:a with:b length:strlen(b)+1]
  97.  
  98.     id s = [NXApp appSpeaker];
  99.     int x = 1;
  100.     int doit = NO;
  101.     
  102.     const char *tmpstr = NXGetDefaultValue ([NXApp appName], "Mail");
  103.     
  104.     if (!tmpstr) doit = YES;
  105.     else if (strcmp(tmpstr, "OK")) doit = YES;
  106.     if (doit) x = NXRunAlertPanel("Warning",
  107.         "Due to a bug in Mail.app in the 2.x software release, this action \
  108. will clobber any letter you may be currently composing.",
  109.         "OK", "OK Forever", "Abort");
  110.         
  111.     if (x == 0) NXWriteDefault ([NXApp appName], "Mail", "OK");
  112.     if (x == -1) return self; // abort
  113.  
  114.     NXPortFromName("Mail", NULL); // make sure app is launched
  115.     [[NXApp appSpeaker] setSendPort:NXPortFromName("MailSendDemo", NULL)];
  116.  
  117.     sprintf(subj,"Comments and suggestions for ``%s'' ",[NXApp appName]);
  118.     strcat(subj,versionString); strcat(subj, " (");
  119.     strcat(subj,"PD"); strcat(subj,")");
  120.     strcat(body,NXUserName()); strcat(body,"\n");
  121.  
  122.     call("setTo:","yackd@wombat.ee.byu.edu");
  123.     call("setSubject:",subj);
  124.     call("setBody:",body);
  125.     
  126.     return self;
  127. }
  128.  
  129. @end
  130.